import { createSlice } from '@reduxjs/toolkit'

// 用户角色 '0'：超管，'1'：普通管理员，'2'：企业用户(普通员工)，'3': 司机用户(普通员工)
export const loginRoleSlice = createSlice({
  name: 'loginRole',
  initialState: () => '',
  reducers: {
    updateLoginRole: (
      state,
      { payload = '' }: { payload: string | undefined }
    ) => {
      // 兼容老系统
      localStorage.setItem('loginRole', payload)
      return payload
    }
  }
})
